extends Control


var data = null

signal view(data)
signal edit(data)
signal delete(data)

func _ready():
	pass 

func set_data(data):
	self.data = data
	var id = data["id"]
	$hbox/id.text = str(id)
	var sourceId = data["sourcePokemonId"]
	var targetId = data["targetPokemonId"]
	
	var sourceInfo = DataSource.get_spirit_by_id(sourceId)
	var targetInfo = DataSource.get_spirit_by_id(targetId)
	
	$hbox/name1.text = "%s【%s】" %[sourceInfo["name"], sourceInfo["id"]]
	$hbox/name2.text = "%s【%s】" %[targetInfo["name"], targetInfo["id"]]
	$hbox/level.text = str(data.get("targetPokemonLevel",1))
	$hbox/desc.text = data.get("description","")
	

func _on_view_button_up():
	emit_signal("view", data)


func _on_edit_button_up():
	emit_signal("edit", data)


func _on_delete_button_up():
	emit_signal("delete", data)
